package com.ruoyi.iptv.live.type.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iptv.live.type.mapper.IptvLiveTypeMapper;
import com.ruoyi.iptv.live.type.domain.IptvLiveType;
import com.ruoyi.iptv.live.type.service.IIptvLiveTypeService;
import com.ruoyi.common.core.text.Convert;

/**
 * 直播分类Service业务层处理
 * 
 * @author 玉念聿辉
 * @date 2021-10-20
 */
@Service
public class IptvLiveTypeServiceImpl implements IIptvLiveTypeService 
{
    @Autowired
    private IptvLiveTypeMapper iptvLiveTypeMapper;

    /**
     * 查询直播分类
     * 
     * @param id 直播分类主键
     * @return 直播分类
     */
    @Override
    public IptvLiveType selectIptvLiveTypeById(Long id)
    {
        return iptvLiveTypeMapper.selectIptvLiveTypeById(id);
    }

    /**
     * 查询直播分类列表
     * 
     * @param iptvLiveType 直播分类
     * @return 直播分类
     */
    @Override
    public List<IptvLiveType> selectIptvLiveTypeList(IptvLiveType iptvLiveType)
    {
        return iptvLiveTypeMapper.selectIptvLiveTypeList(iptvLiveType);
    }

    /**
     * 新增直播分类
     * 
     * @param iptvLiveType 直播分类
     * @return 结果
     */
    @Override
    public int insertIptvLiveType(IptvLiveType iptvLiveType)
    {
        iptvLiveType.setCreateTime(DateUtils.getNowDate());
        return iptvLiveTypeMapper.insertIptvLiveType(iptvLiveType);
    }

    /**
     * 修改直播分类
     * 
     * @param iptvLiveType 直播分类
     * @return 结果
     */
    @Override
    public int updateIptvLiveType(IptvLiveType iptvLiveType)
    {
        iptvLiveType.setUpdateTime(DateUtils.getNowDate());
        return iptvLiveTypeMapper.updateIptvLiveType(iptvLiveType);
    }

    /**
     * 批量删除直播分类
     * 
     * @param ids 需要删除的直播分类主键
     * @return 结果
     */
    @Override
    public int deleteIptvLiveTypeByIds(String ids)
    {
        return iptvLiveTypeMapper.deleteIptvLiveTypeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除直播分类信息
     * 
     * @param id 直播分类主键
     * @return 结果
     */
    @Override
    public int deleteIptvLiveTypeById(Long id)
    {
        return iptvLiveTypeMapper.deleteIptvLiveTypeById(id);
    }
}
